home *** CD-ROM | disk | FTP | other *** search
/ Internet.Works 41 / Issue 41.iso / pc / PCSoftware / Rational Software Siteload / SiteLoad.exe / data1.cab / Apache / jserv-1.1 / servlets / IsItWorking.java < prev    next >
Encoding:
Java Source  |  2000-10-23  |  4.5 KB  |  109 lines

  1. /*
  2.  * Copyright (c) 1997-1999 The Java Apache Project.  All rights reserved.
  3.  *
  4.  * Redistribution and use in source and binary forms, with or without
  5.  * modification, are permitted provided that the following conditions
  6.  * are met:
  7.  *
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  *
  11.  * 2. Redistributions in binary form must reproduce the above copyright
  12.  *    notice, this list of conditions and the following disclaimer in
  13.  *    the documentation and/or other materials provided with the
  14.  *    distribution.
  15.  *
  16.  * 3. All advertising materials mentioning features or use of this
  17.  *    software must display the following acknowledgment:
  18.  *    "This product includes software developed by the Java Apache
  19.  *    Project for use in the Apache JServ servlet engine project
  20.  *    <http://java.apache.org/>."
  21.  *
  22.  * 4. The names "Apache JServ", "Apache JServ Servlet Engine" and
  23.  *    "Java Apache Project" must not be used to endorse or promote products
  24.  *    derived from this software without prior written permission.
  25.  *
  26.  * 5. Products derived from this software may not be called "Apache JServ"
  27.  *    nor may "Apache" nor "Apache JServ" appear in their names without
  28.  *    prior written permission of the Java Apache Project.
  29.  *
  30.  * 6. Redistributions of any form whatsoever must retain the following
  31.  *    acknowledgment:
  32.  *    "This product includes software developed by the Java Apache
  33.  *    Project for use in the Apache JServ servlet engine project
  34.  *    <http://java.apache.org/>."
  35.  *
  36.  * THIS SOFTWARE IS PROVIDED BY THE JAVA APACHE PROJECT "AS IS" AND ANY
  37.  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  38.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  39.  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE JAVA APACHE PROJECT OR
  40.  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  41.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  42.  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  43.  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  44.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  45.  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  46.  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  47.  * OF THE POSSIBILITY OF SUCH DAMAGE.
  48.  *
  49.  * This software consists of voluntary contributions made by many
  50.  * individuals on behalf of the Java Apache Group. For more information
  51.  * on the Java Apache Project and the Apache JServ Servlet Engine project,
  52.  * please see <http://java.apache.org/>.
  53.  *
  54.  */
  55.  
  56. import java.io.*;
  57. import javax.servlet.*;
  58. import javax.servlet.http.*;
  59.  
  60. /**
  61.  * This servlet is used to tell the if the Apache JServ installation was
  62.  * successful.
  63.  *
  64.  * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  65.  */
  66.  
  67. public class IsItWorking extends HttpServlet {
  68.  
  69.     public static final String TITLE = "Yes, It's working!";
  70.  
  71.     public void service (HttpServletRequest request, HttpServletResponse response)
  72.         throws ServletException, IOException
  73.     {
  74.         // set content type and other response header fields first
  75.         response.setContentType("text/html");
  76.  
  77.         // get the communication channel with the requesting client
  78.         PrintWriter out = response.getWriter();
  79.  
  80.         // get the server identification
  81.         String server = getServletConfig().getServletContext().getServerInfo();
  82.  
  83.         // write the data
  84.         out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">"
  85.             + "<HTML>"
  86.             + "<HEAD>"
  87.             + " <TITLE>" + TITLE + "</TITLE>"
  88.             + " <META NAME=\"Author\" CONTENT=\"" + server + "\">"
  89.             + "</HEAD>"
  90.             + "<BODY BGCOLOR=\"#FFFFFF\">"
  91.             + " <CENTER>"
  92.             + "  <IMG "
  93. //default configuration just serves /jserv from localhost for security reasons:
  94.         + "ALT=\"[ Picture broken ? Access this from localhost ]\" "
  95.         + "SRC=\"/jserv/status?image\" BORDER=\"0\">"
  96.             + "  <H1>" + TITLE + "</H1>"
  97.             + "  <H2>Congratulations, " + server + " is working!</H2>"
  98.             + "  <H3>[ local time is <font color='#FF9900'>" 
  99.         + new java.util.Date() + "</font> ]</H3>"
  100.             + "  <FONT SIZE=\"-1\">Copyright (c) 1997-99"
  101.             + "  <A HREF=\"http://java.apache.org/\">The Java Apache Project</a><br>"
  102.             + "  All rights reserved.</FONT>"
  103.             + " </CENTER>"
  104.             + "</BODY>"
  105.             + "</HTML>");
  106.     }
  107. }
  108.  
  109.